package com.hyzh.latte.hj.enterprise;

import com.coffee.core.CoffeeEnum;

/**
 * type: M: 分钟;  H: 时；  D：天
 * @author songkui
 * @since 2024/5/8 18:08
 */
public enum TypeToCommandEnum implements CoffeeEnum<String> {
    H("H", CommandCodeEnum.HD),
    M("M", CommandCodeEnum.MD),
    D("D", CommandCodeEnum.DD);

    private final String code;
    private final CommandCodeEnum command;

    TypeToCommandEnum(String code, CommandCodeEnum command){
        this.code = code;
        this.command = command;
    }


    @Override
    public String code() {
        return this.code;
    }

    @Override
    public String label() {
        return null;
    }

    public CommandCodeEnum command() {
        return this.command;
    }

    public static TypeToCommandEnum ofCode(String code) {
        for (TypeToCommandEnum genderEnum : values()) {
            if (genderEnum.code.equals(code)) {
                return genderEnum;
            }
        }
        return null;
    }


}
